﻿// -----------------------------------------------------------------------
// <copyright file="DomainElement.cs" company="JSC Centido">
//  Copyright (c) JSC Centido. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace Centido.Core.Configuration
{
    using System.Configuration;
    using System.Diagnostics.CodeAnalysis;

    /// <summary>
    ///   Domain parameters in a data access application section
    /// </summary>
    public sealed class DomainElement : ConfigurationElement
    {
        /// <summary>
        ///   Domain name
        /// </summary>
        [ConfigurationProperty("name", IsRequired = true, IsKey = true, DefaultValue = "Default")]
        public string Name
        {
            get { return (string)this["name"]; }
            set { this["name"] = value; }
        }

        /// <summary>
        ///   Database provider name
        /// </summary>
        [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db"),
         ConfigurationProperty("dbProvider", IsRequired = true, DefaultValue = "Npgsql")]
        public string DbProviderName
        {
            get { return (string)this["dbProvider"]; }
            set { this["dbProvider"] = value; }
        }

        /// <summary>
        ///   Database connection string
        /// </summary>
        [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db"),
         ConfigurationProperty("dbConnection", IsRequired = true)]
        public string DbConnection
        {
            get { return (string)this["dbConnection"]; }
            set { this["dbConnection"] = value; }
        }

        /// <summary>
        ///   Database schema name
        /// </summary>
        [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db"),
         ConfigurationProperty("dbSchema", DefaultValue = "")]
        public string DbSchema
        {
            get { return (string)this["dbSchema"]; }
            set { this["dbSchema"] = value; }
        }
    }
}